<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>vue3-escook</title>
  <link rel="stylesheet" href="./lib/style.css">
  <style>
    .skin {
      --w: #fff;
      background: linear-gradient(45deg, green, cyan);
      color: var(--w);
      border: 2px solid var(--w);
      padding: 5px 15px;
      border-radius: 6px;
    }
  </style>
  <script type="importmap">
    {
      "imports" : {
        "vue": "./lib/vue-3.4.29.js"
      }
    }
  </script>
  <script type="module">
    import { createApp, ref } from 'vue'

    const app = createApp({
      setup() {
        const count = ref(0)
        const add = (num, e) => {
          count.value += num
          e.target.classList.toggle('skin')
        }

        return {
          count,
          add
        }
      }
    })

    app.mount('#app')
  </script>
</head>

<body>
  <div id="app">
    <h1>count 的值是：{{ count }}</h1>
    <!-- <button @click="add">+1</button> -->
    <button @click="add(1, $event)">+1</button>
    <button @click="add(2, $event)">+2</button>
  </div>
</body>

</html>